(function ($) {
	var preData = {},pageType = '',pageArr = []
	$.init();
	$.plusReady(function() {
		baseSetup();
	})
	if (!mui.os.plus) {
		baseSetup()
	}
	
	function updateUI(){
		var pageArr = getDetailPageArr(pageType)
		var html = ''
		var titleStr = pageType;
		var statusDesc = ''
		var htmls = ''
		for (var i = 0; i < pageArr.length;i++) {
			var oneData = pageArr[i];
			var title = oneData['text']
			var keyStr = oneData['key']
			var keyType = oneData['type']
			var valueStr = preData[keyStr];
			if (keyStr == 'TranLevel') {
				var levelDict = {'H':'院级','L':'科室','W':'病区'}
				valueStr = levelDict[valueStr]
			}
			var html = '<li class="mui-table-view-cell"><div class="leftText">'+title+'：</div><div class="rightText">'
			if (keyType == 'file') {
				html +=getDetailFileHtml(valueStr,1,TomcatUrl,zkPath)
			}else{
				html += valueStr
			}
			html +='</div></li>'
			htmls += html
		}
		$('#middleUL')[0].innerHTML = htmls
		
		var statusText = '保存'
		var statusIcon = 'nur-statusS'
		if (pageType == '培训登记') {
			statusText = preData['StatusDesc']
			if (statusText == '保存' || statusText == '未发布') {
				statusIcon = 'nur-statusS'
			}else if (statusText == '已发布') {
				statusIcon = 'nur-yifabu'
				if (preData['TranIsFinishDesc'] == '已完成') {
					statusIcon = 'nur-wancheng'
					statusText = preData['TranIsFinishDesc']
				}
			}
			$('#applyer')[0].innerHTML = dealUndefined(preData['TranCratorDesc'])+' '+pageType+''
			$('#appDate')[0].innerHTML = '保存时间：'+dealUndefined(preData['TranCreatDate'])
		}else{
			$('#applyer')[0].innerHTML = dealUndefined(preData['CreatorName'])+' '+pageType+''
			$('#appDate')[0].innerHTML = '保存时间：'+dealUndefined(preData['CreateDate'])
		}
		$('#processUL')[0].innerHTML = '<li class="mui-table-view-cell pass">'+
				'<div class="processIcon"><div class="nurfont nur-correct"></div></div>'+
				'<div class="oneline">'+
					'<div class="dealName mui-ellipsis">'+ 
						(pageType == '培训登记'?preData['TranCratorDesc']:preData['CreatorName']) +'  保存</div>'+
				'</div>'+
				'<div class="dealLoc mui-ellipsis"></div>'+
			'</li>'
	}
	
	function baseSetup(){
		$('.mui-scroll-wrapper').scroll({
			bounce: true,
			indicators: false, //是否显示滚动条
		});
		var self = plus.webview.currentWebview()
		preData = self.data
		pageType = self.pageType
		updateUI()
	}
	
})(mui)